package com.example.ws.service;

import com.example.ws.config.RedisConfig;
import com.example.ws.web.ChatEndpoint;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
import org.springframework.stereotype.Component;

import javax.websocket.Session;

@Component
@Slf4j
public class RedisMessagePublisher {
    @Autowired
    private RedisTemplate<String,Object> redisTemplate;

    public void publishMessage(String message){
        redisTemplate.convertAndSend(RedisConfig.CHANNEL,message);
    }

}
